<?php
/**
*	last change: 2015-12-06
*       Available under the gpl version3 (http://www.gnu.org/copyleft/fdl.html) as source code was taken from  http://www.mediawiki.org/wiki/Extension:VideoFlash
*       Modification by SignpostMarv xiaoji
*       add background image
*/ 

$wgExtensionFunctions[] = 'wfAddBackground';
$wgExtensionCredits['parserhook'][] = array(
	'name' => 'AddBackground',
	'description' => 'Allows to add background image',
	'author' => 'shouhuanxiaoji',
	'version' => '0.0.1',
	'url' => 'http://www.gamux.org'
);

function wfAddBackground() {
	global $wgParser;
	$wgParser->setHook('ab', 'renderAddBackground');
}

# The callback function for converting the input text to HTML output
function renderAddBackground($input) {
	if($input == "") {
		$output = "<script>$('.section').css('background', 'url(http://dota2.yzz.cn/pc/img/d7.jpg)');</script>";
		return $output;
	}
	else {
		$output = "<script>$('.section').css('background', 'url(".$input.")');</script>";
		return $output;
	}
}